package router

import (
	"github.com/gin-gonic/gin"
	"log"
	"payment/app/controller"
)

func GetRouter() *gin.Engine {
	// Engin
	router := gin.Default()
	//router := gin.New()
	v1 := router.Group("/v1/")
	{

		v1.POST("payment", controller.Payment)
		//创建入金订单
		v1.POST("create_in_order", controller.CreateInOrder)
		//同步订单状态
		v1.POST("get_order_status", controller.GetOrderStatus)
	}

	rz := router.Group("/razorpay/")
	{
		rz.POST("callback", controller.OrderCallback)
	}
	router.GET("/hello", func(context *gin.Context) {
		log.Println(">>>> hello gin start <<<<")
		context.JSON(200, gin.H{
			"code":    200,
			"success": true,
		})
	})

	return router
}
